@echo off
chcp 65001 >nul
title Moco服务器启动器

echo.
echo ====================================
echo    商家端Moco服务器启动器
echo ====================================
echo.

:: 检查Java是否安装
java -version >nul 2>&1
if %errorlevel% neq 0 (
    echo [错误] 未检测到Java环境，请先安装Java JDK 8或更高版本
    echo 下载地址: https://www.oracle.com/java/technologies/downloads/
    pause
    exit /b 1
)

:: 检查moco-runner文件是否存在
if not exist "moco-runner-1.3.0-standalone.jar" (
    echo [错误] 未找到moco-runner-1.3.0-standalone.jar文件
    echo 请下载moco-runner: https://repo1.maven.org/maven2/com/github/dreamhead/moco-runner/1.3.0/moco-runner-1.3.0-standalone.jar
    pause
    exit /b 1
)

:: 检查配置文件是否存在
if not exist "merchant-api.json" (
    echo [错误] 未找到merchant-api.json配置文件
    pause
    exit /b 1
)

echo [启动] 正在启动Moco服务器...
echo [端口] 8080
echo [配置] merchant-api.json
echo.
echo 提示: 按Ctrl+C停止服务器
echo.

:: 启动Moco服务器
java -jar moco-runner-1.3.0-standalone.jar http -p 8080 -c merchant-api.json

pause




